home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / imc9104.zip / MOUSE4I.C < prev    next >
Text File  |  1991-03-05  |  2KB  |  68 lines

  1. /*******************************************************************
  2. * Customizing the graphics mouse cursor: code from Figure 4I       *
  3. *******************************************************************/
  4. #include <conio.h>  /* kbhit(), getch()     */
  5. #include <dos.h>    /* int86(), union REGS  */
  6. #include <stdio.h>  /* puts()               */
  7. #include <stdlib.h> /* exit(), EXIT_FAILURE */
  8. #include <graph.h>
  9.  
  10. void main(void)
  11.     {
  12.     union REGS regs;
  13.     unsigned int bullseye[]=
  14.         {
  15.         /* Screen Mask */
  16.         0x0000, 0x0000, 0x0000, 0x0000,
  17.         0x0000, 0x0000, 0x03c0, 0x03c0,
  18.         0x0000, 0x0000, 0x0000, 0x0000,
  19.         0x0000, 0x0000, 0xffff, 0xffff,
  20.         /* Cursor Mask */
  21.         0xaaaa, 0xaaaa, 0x9556, 0x9556,
  22.         0x9ff6, 0x9ff6, 0x9ff6, 0x9ff6,
  23.         0x9ff6, 0x9ff6, 0x9556, 0x9556,
  24.         0xaaaa, 0xaaaa, 0x0000, 0x0000
  25.         };
  26.     char fred[100];
  27.  
  28.     _setvideomode(_MRES4COLOR);
  29.     _selectpalette(0);
  30.  
  31.     /* Initialize the mouse */
  32.     regs.x.ax = 0x00;
  33.     int86(0x33, ®s, ®s);
  34.     if (!regs.x.ax)
  35.         {
  36.         puts("ERROR-can't initialize mouse");
  37.         exit(EXIT_FAILURE);
  38.         }
  39.  
  40.     /* Show the mouse */
  41.     regs.x.ax = 0x01;
  42.     int86(0x33, ®s, ®s);
  43.  
  44.     /* Wait for the user to quit */
  45.     _setcolor(0); _rectangle(_GFILLINTERIOR,10,10,20,20);
  46.     _setcolor(1); _rectangle(_GFILLINTERIOR,20,20,30,30);
  47.     _setcolor(2); _rectangle(_GFILLINTERIOR,30,30,40,40);
  48.     _setcolor(3); _rectangle(_GFILLINTERIOR,40,40,50,50);
  49.     puts("You can now see the mouse");
  50.     puts("Press RETURN key to quit");
  51.  
  52.     /* Set the shape of the mouse */
  53.     regs.x.ax = 9;
  54.     regs.x.bx = 7;
  55.     regs.x.cx = 7;
  56.     regs.x.dx = (int) bullseye;
  57.     int86(0x33,®s,®s);
  58.  
  59.     /* Wait for a carriage return */
  60.     gets(fred);
  61.     
  62.     /* Hide the mouse */
  63.     regs.x.ax = 0x02;
  64.     int86(0x33, ®s, ®s);
  65.  
  66.     _setvideomode(_DEFAULTMODE);
  67.     }
  68.